package com.webank.webase.data.collect.dao.mapper;

import com.webank.webase.data.collect.dao.entity.TbEventInfo;
import com.webank.webase.data.collect.dao.entity.TbEventInfoExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbEventInfoMapper {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbEventInfoSqlProvider.class, method = "countByExample")
    long countByExample(@Param("tableName") String tableName, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbEventInfoSqlProvider.class, method = "deleteByExample")
    int deleteByExample(@Param("tableName") String tableName, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Delete({ "delete from ${tableName}", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(@Param("tableName") String tableName, @Param("id") Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Insert({ "insert into ${dynamicTableName} (contract_name, contract_address, ", "user_address, block_number, ", "trans_hash, block_timestamp, ", "create_time, modify_time, ", "event_info)", "values (#{contractName,jdbcType=VARCHAR}, #{contractAddress,jdbcType=VARCHAR}, ", "#{userAddress,jdbcType=VARCHAR}, #{blockNumber,jdbcType=BIGINT}, ", "#{transHash,jdbcType=VARCHAR}, #{blockTimestamp,jdbcType=TIMESTAMP}, ", "#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, ", "#{eventInfo,jdbcType=LONGVARCHAR})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbEventInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbEventInfoSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbEventInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbEventInfoSqlProvider.class, method = "selectByExampleWithBLOBs")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "contract_name", property = "contractName", jdbcType = JdbcType.VARCHAR), @Result(column = "contract_address", property = "contractAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "user_address", property = "userAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "block_number", property = "blockNumber", jdbcType = JdbcType.BIGINT), @Result(column = "trans_hash", property = "transHash", jdbcType = JdbcType.VARCHAR), @Result(column = "block_timestamp", property = "blockTimestamp", jdbcType = JdbcType.TIMESTAMP), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "event_info", property = "eventInfo", jdbcType = JdbcType.LONGVARCHAR) })
    List<TbEventInfo> selectByExampleWithBLOBs(@Param("tableName") String tableName, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbEventInfoSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "contract_name", property = "contractName", jdbcType = JdbcType.VARCHAR), @Result(column = "contract_address", property = "contractAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "user_address", property = "userAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "block_number", property = "blockNumber", jdbcType = JdbcType.BIGINT), @Result(column = "trans_hash", property = "transHash", jdbcType = JdbcType.VARCHAR), @Result(column = "block_timestamp", property = "blockTimestamp", jdbcType = JdbcType.TIMESTAMP), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    List<TbEventInfo> selectByExample(@Param("tableName") String tableName, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Select({ "select", "id, contract_name, contract_address, user_address, block_number, trans_hash, ", "block_timestamp, create_time, modify_time, event_info", "from ${tableName}", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "contract_name", property = "contractName", jdbcType = JdbcType.VARCHAR), @Result(column = "contract_address", property = "contractAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "user_address", property = "userAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "block_number", property = "blockNumber", jdbcType = JdbcType.BIGINT), @Result(column = "trans_hash", property = "transHash", jdbcType = JdbcType.VARCHAR), @Result(column = "block_timestamp", property = "blockTimestamp", jdbcType = JdbcType.TIMESTAMP), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "event_info", property = "eventInfo", jdbcType = JdbcType.LONGVARCHAR) })
    TbEventInfo selectByPrimaryKey(@Param("tableName") String tableName, @Param("id") Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbEventInfoSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("tableName") String tableName, @Param("record") TbEventInfo record, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbEventInfoSqlProvider.class, method = "updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("tableName") String tableName, @Param("record") TbEventInfo record, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbEventInfoSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("tableName") String tableName, @Param("record") TbEventInfo record, @Param("example") TbEventInfoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbEventInfoSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(@Param("tableName") String tableName, @Param("record") TbEventInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Update({ "update ${tableName}", "set contract_name = #{record.contractName,jdbcType=VARCHAR},", "contract_address = #{record.contractAddress,jdbcType=VARCHAR},", "user_address = #{record.userAddress,jdbcType=VARCHAR},", "block_number = #{record.blockNumber,jdbcType=BIGINT},", "trans_hash = #{record.transHash,jdbcType=VARCHAR},", "block_timestamp = #{record.blockTimestamp,jdbcType=TIMESTAMP},", "create_time = #{record.createTime,jdbcType=TIMESTAMP},", "modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},", "event_info = #{record.eventInfo,jdbcType=LONGVARCHAR}", "where id = #{record.id,jdbcType=INTEGER}" })
    int updateByPrimaryKeyWithBLOBs(@Param("tableName") String tableName, @Param("record") TbEventInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Update({ "update ${tableName}", "set contract_name = #{record.contractName,jdbcType=VARCHAR},", "contract_address = #{record.contractAddress,jdbcType=VARCHAR},", "user_address = #{record.userAddress,jdbcType=VARCHAR},", "block_number = #{record.blockNumber,jdbcType=BIGINT},", "trans_hash = #{record.transHash,jdbcType=VARCHAR},", "block_timestamp = #{record.blockTimestamp,jdbcType=TIMESTAMP},", "create_time = #{record.createTime,jdbcType=TIMESTAMP},", "modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}", "where id = #{record.id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(@Param("tableName") String tableName, @Param("record") TbEventInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "list.id", keyColumn = "id")
    @Insert({ "<script>", "insert into ${tableName} (contract_name, ", "contract_address, user_address, ", "block_number, trans_hash, ", "block_timestamp, create_time, ", "modify_time, event_info)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.contractName,jdbcType=VARCHAR}, ", "#{detail.contractAddress,jdbcType=VARCHAR}, #{detail.userAddress,jdbcType=VARCHAR}, ", "#{detail.blockNumber,jdbcType=BIGINT}, #{detail.transHash,jdbcType=VARCHAR}, ", "#{detail.blockTimestamp,jdbcType=TIMESTAMP}, #{detail.createTime,jdbcType=TIMESTAMP}, ", "#{detail.modifyTime,jdbcType=TIMESTAMP}, #{detail.eventInfo,jdbcType=LONGVARCHAR})</foreach></script>" })
    int batchInsert(@Param("tableName") String tableName, @Param("list") List<TbEventInfo> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_event_info
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbEventInfoSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "contract_name", property = "contractName", jdbcType = JdbcType.VARCHAR), @Result(column = "contract_address", property = "contractAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "user_address", property = "userAddress", jdbcType = JdbcType.VARCHAR), @Result(column = "block_number", property = "blockNumber", jdbcType = JdbcType.BIGINT), @Result(column = "trans_hash", property = "transHash", jdbcType = JdbcType.VARCHAR), @Result(column = "block_timestamp", property = "blockTimestamp", jdbcType = JdbcType.TIMESTAMP), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "event_info", property = "eventInfo", jdbcType = JdbcType.LONGVARCHAR) })
    Optional<TbEventInfo> getOneByExample(@Param("tableName") String tableName, @Param("example") TbEventInfoExample example);
}
